let nums = [10,4,8,3]
var leftRightDifference = function(nums) {
    let right = nums.reduce((a,b)=>a+b)
    let left = 0
    return nums.map((item)=>{
        right -=item
        res = Math.abs(right - left)
        left +=item
        return res
    })
}
console.log(leftRightDifference(nums));
